package xia;
import android.view.ViewGroup;
import com.zlp.mymapviewproject.mymapview.MyMapPointWithTitleView;
import com.zlp.mymapviewproject.mymapview.MyMapPointWithTitleView_xuanfu_mark;
import org_rosjava.ros.android.android_tutorial_map_viewer.My_map;
public class XuanfuButton_Create {
    public static void createFloatView(String pointTitle, final float downX, final float downY, float fingerX, float fingerY, String xuanfuButton_type)
    {
        try {
            if (My_map.getinstance().isAdded) {
                removeXuanfuButtonView();
                My_map.getinstance().isAdded = false;
            }
            if(xuanfuButton_type.equals("blank"))
            {
                    MyMapPointWithTitleView_xuanfu_mark myMapPointWithTitleView_xuanfu_mark = new MyMapPointWithTitleView_xuanfu_mark(My_map.getinstance(), downX, downY, MyMapPointWithTitleView_xuanfu_mark.MARK_POINT, true, "" );
                    My_map.getinstance().myMapView.addMapPoint_xuanfu_mark(myMapPointWithTitleView_xuanfu_mark);
                    XuanfuButton_Click_blank_menu.init_xuanfuButton_blank(fingerX, fingerY, downX, downY,myMapPointWithTitleView_xuanfu_mark);
                    My_map.getinstance().activity.addContentView(My_map.getinstance().xuanfuButton_blank, My_map.getinstance().params_xuanfu);
                    My_map.getinstance().xuanfuButton_PointonLongClick=null;
                    My_map.getinstance().isAdded = true;

            }
            else if(xuanfuButton_type.equals("PointonLongClick")) {
                MyMapPointWithTitleView myMapPointWithTitleView_tmp = new MyMapPointWithTitleView(My_map.getinstance(), downX, downY, MyMapPointWithTitleView.MARK_POINT, true, "",0);
                My_map.getinstance().myMapView.addMapPoint_tmp(myMapPointWithTitleView_tmp);
                XuanfuButton_Click_point_menu.init_xuanfuButton_PointonLongClick(pointTitle,downX,downY,fingerX, fingerY);
                My_map.getinstance().activity.addContentView(My_map.getinstance().xuanfuButton_PointonLongClick, My_map.getinstance().params_xuanfu);
                My_map.getinstance().xuanfuButton_blank=null;
                My_map.getinstance().isAdded = true;
            }
            My_map.getinstance().myMapView.Refresh_show_get_new_map_picture( );
        } catch (Exception e) {
        }
    }

    public static void removeXuanfuButtonView()
    {
        try {
            My_map.getinstance().myMapView.rmMapPoint_xuanfu_mark();
            My_map.getinstance().myMapView.rmMapPoint_tmp();
            if(My_map.getinstance().xuanfuButton_blank!=null) {
                ((ViewGroup) My_map.getinstance().xuanfuButton_blank.getParent()).removeView(My_map.getinstance().xuanfuButton_blank);
                My_map.getinstance().xuanfuButton_blank=null;
            }
            if(My_map.getinstance().xuanfuButton_PointonLongClick!=null) {
                ((ViewGroup) My_map.getinstance().xuanfuButton_PointonLongClick.getParent()).removeView(My_map.getinstance().xuanfuButton_PointonLongClick);
                My_map.getinstance().xuanfuButton_PointonLongClick=null;
            }
        } catch (Exception e) {
        }
    }
}